package di

import (
	"gorm_demo/pkg/config"
	"gorm_demo/pkg/logger"
	repo "gorm_demo/pkg/repo"
	"gorm_demo/pkg/service"

	"go.uber.org/dig"
)

var container = dig.New()

func BuildContainer() *dig.Container {
	// config
	container.Provide(config.NewConfig)
	container.Provide(logger.NewLogger)

	// DB

	// user
	container.Provide(repo.NewAuthUserRepository)
	container.Provide(service.NewAuthUserService)

	return container
}

func Invoke(i interface{}) error {
	return container.Invoke(i)
}
